#include <iostream>
using namespace std;

int main(int argc, char const *argv[])
{
    int a, b, c, d;
    if((scanf("%d.%d.%d.%d", &a, &b, &c, &d) != 4) ||
        getchar() != '\n')
    {
        cout << "NO" << endl;
        return 0;
    }

    if(0<=a && a<=255 &&
       0<=b && b<=255 &&
       0<=c && c<=255 &&
       0<=d && d<=255)
    {
        cout << "YES" << endl;
    }
    else
        cout << "NO" << endl;

    return 0;
}